package com.marvels.approve.process.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.marvels.approve.process.dto.HandleProcessDTO;
import com.marvels.approve.process.dto.LoanApplyCaseDTO;
import com.marvels.common.exception.MarvelsBusinessException;

public interface ILoanApplyCaseDao {
	
	
	public List<LoanApplyCaseDTO> selectByAssignee(LoanApplyCaseDTO loanApplyCase);
	
	/**新增
	 * @param caseManager
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public int insert(LoanApplyCaseDTO loanApplyCase);
	
	/**更新
	 * @param CaseManagerVersionVersion
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public int updateByPrimaryKeySelective(LoanApplyCaseDTO loanApplyCase);
	
	/**
	 * 根据LoanId更新
	 * @param loanApplyCase
	 * @return
	 */
	public int updateByLoanId(LoanApplyCaseDTO loanApplyCase);
	/**通过主键ID
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public LoanApplyCaseDTO selectByPrimaryKey(Long id);
	/**查询多条数据
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<LoanApplyCaseDTO> select(LoanApplyCaseDTO loanApplyCaseDTO);
	/**查询多条数据,woChecking woApproval woSampling
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<LoanApplyCaseDTO> selectSelf(LoanApplyCaseDTO loanApplyCaseDTO);
	
	/**通过权限查询客户待取件
	 * @author 何杰
	 * 2018年4月16日
	 * @param roles
	 * @return
	 */
	public Integer selectWaitProcessNum(@Param("roles") List<String> roles,@Param("nodes") List<String> nodes);
	/**
	 * 基于loanid  查询进件的基本信息
	 * @param loanId
	 * @return
	 */
	public LoanApplyCaseDTO getEntityByLoanId(@Param("loanId") String loanId);
	
	/**
	 * 查询不在caseStatus的进件记录 
	 * @param loanId
	 * @param caseStatus
	 * @return
	 */
	public LoanApplyCaseDTO getEntity(@Param("loanId") String loanId,@Param("caseStatus") String caseStatus);
	
	/**
	 * 查询某个节点下的进件记录
	 * @param loanId
	 * @param nodeCode
	 * @return
	 */
	public LoanApplyCaseDTO getEntityByNodeCode(@Param("loanId") String loanId,@Param("nodeCode") String nodeCode);
	
	/**
	 * 从某个流程节点中取出一条件
	 * @param curNodeCode
	 * @return
	 */
	public LoanApplyCaseDTO getTaskToDeal(@Param("curNodeCode") String curNodeCode);

	/**通过节点查询工单跟踪表
	 * @author 何杰
	 * 2018年5月14日
	 * @param nodes
	 * @return
	 */
	public List<LoanApplyCaseDTO> selectLoanApplyCases(HandleProcessDTO handleProcessDTO);
	
	/**通过节点查询工单跟踪表
	 * @author 何杰
	 * 2018年5月14日
	 * @param nodes
	 * @return
	 */
	public LoanApplyCaseDTO selectLoanApplyCasesByLondId(HandleProcessDTO handleProcessDTO);
	
	/**处理工单
	 * @author 何杰
	 * 2018年5月14日
	 * @return
	 */
	public Integer transferLoanApplyCases(LoanApplyCaseDTO loanApplyCase);
	
	/**转件查询流程
	 * @author 何杰
	 * 2018年5月20日
	 * @param loanApplyCase
	 * @return
	 */
	public List<LoanApplyCaseDTO> selectLoanApplyCaseForTransfers(LoanApplyCaseDTO loanApplyCase);

	/**
	 *   根据状态查询是否有面签的用户
	 * @param caseStatus
	 * @return
	 */
	public List<LoanApplyCaseDTO> queryBycaseStatus(@Param("caseStatus") String caseStatus);
	
	
	/**
	 * 通过loanId查询工单信息
	 * @param loanId
	 * @return
	 */
	public LoanApplyCaseDTO selectByLoanId(@Param("loanId") String loanId);
	/**
	 * 面签取消时，重置处理人
	 * @param loanApplyCase
	 * @return
	 */
	public int updateAssignee(LoanApplyCaseDTO loanApplyCase);
}
